Repository navigation
Conversation
handleMergeDuplicates branched on getTopmostReportId, which only inspects the Inbox (Reports split) navigator. When the flow is opened from Search it never matches the kept expense report, so the else branch ran goBack(keptReportRoute) and opened the kept report in the Inbox instead of returning to Spend > Expenses. For cross-report merges that goBack resolved to a REPLACE (the kept expense report was never on the stack), leaving the torn-down discarded thread reachable via the browser back button, which then rendered a NotFound page. Replace the branch with origin-aware navigation: when opened from Search (the route carries a backTo param) dismiss the modal back to the search results; otherwise dismiss the duplicates modal (popping its history entries) and replace the now-dead thread with the kept report so browser-back lands on a live screen.
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@QichenZhu Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a8b556e929
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const topmostReportID = Navigation.getTopmostReportId?.(); | ||
| if (topmostReportID === mergeParams.reportID) { | ||
| // Opened from Search: dismiss back to the search results instead of opening the kept report in the Inbox. | ||
| if (route.params.backTo) { |
There was a problem hiding this comment.
Preserve kept-report replace for review backTo routes
This condition also matches the normal Inbox Review Duplicates flow: keepSelected in src/pages/TransactionDuplicate/Review.tsx builds the confirmation route with backTo: Navigation.getActiveRoute(), so route.params.backTo is set even when the modal was not opened from Search. In that case we now just dismiss the modal and skip the forceReplace to keptReportRoute, leaving the underlying discarded transaction thread focused after merge; once the server deletes it, browser Back can still land on the torn-down thread/NotFound page that this change is trying to avoid. The Search case needs to be distinguished from the internal review backTo route rather than treating any backTo as Search-originated.
Useful? React with 👍 / 👎.
|
@ikevin127 all yours. cc @Valforte |
route.params.backTo is always set on the duplicates confirmation page (Review's keepSelected passes Navigation.getActiveRoute through to the confirmation route), so it can't distinguish the Search entry point from the normal Inbox review flow. Relying on it made the Inbox merge take the dismiss-only branch, skip the forceReplace, and leave the user on the torn-down discarded thread. Detect Search via isSearchTopmostFullScreenRoute instead, matching the delete-expense flow.
|
@MobileMage Tip: the original reviewers will be assigned automatically if you link the main ticket in Fixed Issues next time. |
|
Thank you @QichenZhu |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
|
🚧 @Valforte has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
…ion-93362-93363 Fix Review Duplicates merge navigation from Search and on browser back (cherry picked from commit 4004b66) (cherry-picked to staging by Julesssss)
|
🚀 Cherry-picked to staging by https://github.com/Julesssss in version: 9.4.6-1 🚀
Bundle Size Analysis (Sentry): |
Help site review: no docs changes requiredI reviewed this PR against the help site articles under Why: This PR is a pure navigation bug fix in The closest article, How to find and resolve flagged duplicate expenses, documents the user-facing flow (Fix badge → Review duplicates → Keep all / Keep selected → Confirm). None of those documented steps, labels, or outcomes change in this PR — the post-merge navigation destination it fixes is internal behavior that the article does not describe. Since no docs updates are needed, I did not create a draft help site PR. |
|
🚀 Deployed to production by https://github.com/Julesssss in version: 9.4.6-4 🚀
|
|
🚀 Cherry-picked to staging by https://github.com/Julesssss in version: 9.4.7-0 🚀
Bundle Size Analysis (Sentry): |
|
🚀 Deployed to production by https://github.com/puneetlath in version: 9.4.7-4 🚀
|
Explanation of Change
#92838 (fix for #92302) replaced the unconditional
Navigation.dismissModal()at the end of the Review Duplicates merge flow (handleMergeDuplicatesinConfirmation.tsx) with a branch keyed onNavigation.getTopmostReportId(). That branch regressed two flows:getTopmostReportId()only inspects the Inbox (Reports split navigator), so when the flow is opened from Search it never matches the kept transaction's expense report. Theelsebranch ranNavigation.goBack(keptReportRoute), opening the kept report in the Inbox instead of returning to the search results.goBack(keptReportRoute)resolves to a REPLACE rather than a pop. On web that leaves the discarded thread's history entries (/r/<thread>,…/duplicates/review) reachable; combined with the suppressor NVP being cleared when the kept report loses focus, pressing the browser Back button lands on the torn-down thread's NotFound page.This PR replaces that branch with origin-aware navigation:
backToparam), dismiss the modal back to the search results.forceReplace, so the browser Back button can't reach a torn-down screen.The original #92302 cross-report cleanup in
Duplicate.tsis unchanged.Fixed Issues
$ #93362
PROPOSAL: #93362 (comment)
$ #93363
PROPOSAL: #93363 (comment)
Tests
Offline tests
Same as Tests, but enable airplane mode / disable the network before pressing Confirm, then re-enable the network:
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
joined-93363-93362.mp4